#{extends 'main.html' /}
#{set title:'Transfer project ownership' /}

#{set 'moreStyles'}
<style>
.alert,
.alert p {
    font-size: 12pt;
}
.alert p {
    margin: 1em 0;
}
.transfer {
    font-size: 24pt;
    line-height: 30pt;
    text-align: center;
}
.owner {
    display: inline-block;
}
.arrow {
    font-size: 40pt;
}
</style>
#{/set}

<h1>Transfer ownership</h1>

<div class="alert">
    <h4 class="alert-heading">Warning!</h4>
    <p>
        You are about to transfer ownership of project 
        <a href="@{Projects.view(project.id)}" title="View project claim">${project.moduleName}</a>
    </p>
    <div class="transfer">
        <div class="owner">
            From<br/>
            #{user project.owner, img: true, size: 50 /}
        </div>
        <span class="arrow">→</span>
        <div class="owner">
            To<br/>
            #{user newOwner, img: true, size: 50 /}
        </div>
    </div>
    <p>
        You understand that once you´ve transfered ownership of this project:
    </p>
    <ul>
        <li>The new owner will own this project</li>
        <li>All the corresponding published modules will be transfered to him</li>
        <li>Unless the new owner grants you administration rights, you will not be able to publish this
            module anymore</li>
        <li>You can only get this project back if the new owner transfers it to you or if you reclaim it and
            the Ceylon Herd administrators agree with your claim, for which there is absolutely no guarantee</li>
    </ul>
</div>

<p>
    The following <strong>${publishedModuleVersions?.size() ?: 0} published</strong> modules will be transfered too:
</p>

<ul>
    #{list items: publishedModuleVersions, as:'moduleVersion'}
        <li>
            <a href="@{Repo.view(moduleVersion.module.name, moduleVersion.version)}" title="View module version">${moduleVersion.version}</a>
        </li>
    #{/list}
</ul>

#{form @Projects.transferOwnership2(project.id, newOwner.id), class:"pull-right"}
    #{if module}
        <a href="@{Repo.versions(module.name)}" class="btn" title="Go back to module">Cancel</a>
    #{/if}
    #{else}
        <a href="@{Application.index()}" class="btn" title="Go back to the start">Cancel</a>
    #{/else}
    <button class="btn btn-danger" title="Transfer ownership"><i class="icon-gift icon-white"></i> Transfer ownership to ${newOwner.userName}</button>
#{/form}
